package com.xtiim.battery.discharge.protocal.command;

import com.xtiim.battery.discharge.util.ByteUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import purejavacomm.SerialPort;

@Getter
@AllArgsConstructor
public class BatteryCommand {
    protected String host;
    protected SerialPort port;
    protected CommandType commandType;
    protected byte[] cmd;

    @Override
    public String toString() {
        return new StringBuilder().append("host: " + (host == null ? "" : host) + ", ")
                .append("port: " + (port == null ? "" : port.getName()) + ", ")
                .append("commandType: " + commandType.name() + ", ")
                .append("cmd: " + ByteUtil.byte2hex(cmd))
                .toString();
    }
}
